package ru.ssau.university.persistence.dao;

import java.util.List;

import org.hibernate.Query;

import ru.ssau.hibernate.util.AbstractDAO;
import ru.ssau.university.persistence.entity.Group;

public class GroupDAO extends AbstractDAO<Group>{
	public GroupDAO() {
		this.objectClass = Group.class;
	}

	@SuppressWarnings("unchecked")
	public List<Group> getGroupsByFacultyId(Long facultyId) {
		Query q = createQuery("select g from Group g where g.speciality.faculty.id=:facultyId");
		q.setLong("facultyId", facultyId);
		return q.list();
	}
}
